package com.example.demo.utils;

public class PessimisticLockAdder implements Runnable {
    private int count;

    @Override
    public void run() {
        for (int i = 0; i < 100; i++) {
            //悲观锁
            synchronized (this) {
                System.out.println("count---->" + ++count);
            }
        }
    }
}
